<?php

	if($authInfo->usertype != '0') {
		redirectCleanly("/");
	}
	$uid = extractStringWithKeyFromArray("uid", $_REQUEST);
	
	if (!$uid) {
		$error = "No Such User";
		echo "<div id=\"contentIndex\"><p><b><a class=\"link12bold\" href=\"./popup_userHome.php\">Edit User</a><br><br></p>".$error."</div>";
	} elseif(in_array($uid, $CMS_PROTECTED_USERS)) {
		$error = "This is a Protected User<br>They Cannot be Deleted";
		echo "<div id=\"contentIndex\"><p><b><a class=\"link12bold\" href=\"./popup_userHome.php\">Edit User</a><br><br></p>".$error."</div>";
	} else {
?>
<div id="contentIndex">

	<?
		$deletenow = extractStringWithKeyFromArray("deletenow", $_REQUEST);
		
		if (!$deletenow) {
		?>
        <table border="0" cellspacing="0" cellpadding="0" width="100%">
		    <tr>
		      <td class="body2-4" colspan="3">
		      	<p><b><a class="link12bold" href="./popup_userHome.php">Edit User</a><br><br></p>
		        <p><i>Are you sure you want to delete this user?</i><br><br></b>
		      </td>
		    </tr>
		    <tr>
		      <td class="body2-4" align="right"><b><a href="/cms/html/index.php?fileNo=7">NO</a></b></td>
		      <td width="20">&nbsp;</td>
		      <td class="body2-4" align="left"><b><a href="/cms/html/index.php?fileNo=11&deletenow=true&uid=<?=$uid?>">YES</a></b></td>
		    </tr>		    
        </table>
		<?
		} else {
			$query = "DELETE FROM user WHERE uid=".$uid;
			$db->executeQuery($query);
			$query2 = "DELETE FROM usergroup WHERE uid=".$uid;
			$db->executeQuery($query2);
		?>
        <table border="0" cellspacing="0" cellpadding="0" width="300">
		    <tr>
		      <td class="body2-4" colspan="3">
		      	<p><b><a class="link12bold" href="/cms/html/index.php?fileNo=7">Edit User</a><br><br></p>
		        <i>The user was successfully deleted.</i>
		      </td>
		    </tr>		    
        </table>		
		<?
		}
		?>

</div>
<?
	}
?>